package yr.website

import grails.transaction.Transactional

@Transactional
class RolesService {

    def ad(Roles role) {
        role.createDate = new Date()
        def length = Roles.count()
        if (length == 0) {
            println "1"
            role.roleId = "1"
        } else {
            println "2"
            role.roleId = length + 1 + ""
        }
        println role.roleId
        println role.perId
        println role.name
        role.save()
    }

    def del(Roles role) {
        role.delete()
    }

    def save(Roles role) {
        role.createDate = new Date()
        role.save()
    }
}
